import 'package:flutter/material.dart';
import 'package:flutter_app/components/layout.dart';
import 'package:flutter_app/components/no-record.dart';

class LeverOrderPage extends StatefulWidget {
  int type;
  LeverOrderPage({this.type});
  @override
  _LeverOrderPageState createState() => _LeverOrderPageState();
}

Widget BlackText(String title) {
  return Text(
    title,
    style: TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
  );
}

Widget RowItem(String title, String value) {
  return Expanded(
    child: Column(
      children: [
        Text(
          title,
          style: TextStyle(color: Colors.white54),
        ),
        Text(
          value,
          style: TextStyle(color: Colors.white),
        )
      ],
    ),
  );
}

class _LeverOrderPageState extends State<LeverOrderPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        brightness: Brightness.dark,
        backgroundColor: widget.type==0?Color(0xFFFF9505):Colors.blueAccent,
        elevation: 0,
        title: HeadTitle('我的订单'),
        centerTitle: true,
      ),
      body: Column(
        children: [
          Container(
            color: widget.type==0?Color(0xFFFF9505):Colors.blueAccent,
            child: Column(
              children: [
                SizedBox(
                  height: 20,
                ),
                Center(
                  child: Column(
                    children: [
                      Text(
                        'BTC囤币总资产',
                        style: TextStyle(color: Colors.white54),
                      ),
                      Text(
                        '0.00BTC',
                        style: TextStyle(
                            color: Colors.white,
                            fontWeight: FontWeight.bold,
                            fontSize: 26),
                      ),
                      Text(
                        '≈\$0.00',
                        style: TextStyle(color: Colors.white),
                      )
                    ],
                  ),
                ),
                Padding(
                  padding: const EdgeInsets.symmetric(vertical: 20.0),
                  child: Row(
                    children: [
                      RowItem('囤币本金', '0.00'),
                      RowItem('持仓盈亏', '0.00'),
                    ],
                  ),
                ),
              ],
            ),
          ),
          Topradius(
            bgColor:Colors.orangeAccent,
            padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 15.0),
            child: RowBetween(
              children: [
                Row(
                  children: [Text('成本均价：'), BlackText('\$0.00')],
                ),
                Row(
                  children: [Text('当前价格：'), BlackText('\$0.00')],
                )
              ],
            ),
          ),
          Expanded(
            child: Column(
              children: [
                Expanded(child: NoRecord()),
                Row(
                  children: [
                    Expanded(
                      child: Padding(
                        padding: const EdgeInsets.symmetric(horizontal: 20.0,vertical: 10.0),
                        child: FlatButton(
                            onPressed: () { Navigator.of(context).pop();},
                            color: Colors.blueAccent,
                            textColor: Colors.white,
                            child: Text('去下单')),
                      ),
                    ),
                  ],
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}
